<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用户{:isset($_info['id'])?'编辑':'新增'}</title>

    <!-- Bootstrap -->
    <link href="{:config('__public__')}/static/bootstrap-3.3.4/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<style type="text/css">
    .form-group input,textarea,select{
        margin-bottom:15px; 
    }
    .alert{
        position: fixed;
        z-index: 100;
        margin-left: 20px; 
        width: 80%;
    }
    .alert-success{
        /*color: #fff;
        background-color: #5cb85c;
        border-color: #4cae4c;*/
    }
</style>

    <div class="main-title">
        <h2>{:isset($_info['id'])?'编辑':'新增'}用户</h2>
    </div>
    <div class="container">
    <form class="ajaxForm" action="{:url('save')}">
        <div class="form-group">
            <label class="col-sm-12">用户名<span class="check-tips"></span></label>
            <div class="col-sm-6">
                <input type="text" class="form-control" name="username" value="{$_info.username|default=''}" required="">
            </div>
        </div>
        {empty name="_info['id']"}
        <div class="form-group">
            <label class="col-sm-12">密码<span class="check-tips"></span></label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="password" value="{$_info.password|default=''}" required="" minlength="6">
            </div>
        </div>
        {/empty}
        <div class="form-group">
            <label class="col-sm-12">用户昵称<span class="check-tips"></span></label>
            <div class="col-sm-6">
                <input type="text" class="form-control" name="nickname" value="{$_info.nickname|default=''}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-12">手机号<span class="check-tips"></span></label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="mobile" value="{$_info.mobile|default=''}" required="">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-12">邮箱<span class="check-tips"></span></label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="email" value="{$_info.email|default=''}">
            </div>
        </div>
        <div class=" form-group col-lg-12">
            <input type="hidden" name="id" value="{$_info.id|default=''}">
            <button type="submit" class="btn btn-success">确 定</button>
            <button class="btn btn-warning" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
    </div>


<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<script src="{:config('__public__')}/static/form-3.51/jquery.form.js"></script>
<link rel="stylesheet" href="{:config('__public__')}/static/artDialog-6.0.4/css/ui-dialog.css">
<script src="{:config('__public__')}/static/artDialog-6.0.4/dist/dialog-min.js"></script>
<script src="{:config('__public__')}/Admin/js/ajaxSubmit.js"></script>

<script type="text/javascript" src="/Admin/js/ThinkSetValue.js"></script>
    <script type="text/javascript">
        Think.setValue("type", {$_info.type|default = 1});
        Think.setValue("pid", {$_info.pid|default = 0});
        Think.setValue("hide", {$_info.hide|default = 0});
        Think.setValue("is_dev", {$_info.is_dev|default = 0});
    </script>
<script type="text/javascript">
$(function() {
    //搜索功能
    $("#search").click(function() {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
    //回车搜索
    $(".search-input").keyup(function(e) {
        if (e.keyCode === 13) {
            $("#search").click();
            return false;
        }
    });
    
    //点击排序
    $('.list_sort').click(function(){
        var url = $(this).attr('url');
        var ids = $('.ids:checked');
        var param = '';
        if(ids.length > 0){
            var str = new Array();
            ids.each(function(){
                str.push($(this).val());
            });
            param = str.join(',');
        }

        if(url != undefined && url != ''){
            window.location.href = url + '/ids/' + param;
        }
    });
});
</script>

</body>
</html>